<template>
  <div class="hello">
    <el-table
      :data="tableData"
      style="width: 100%"
      max-height="250">
      <el-table-column
        prop="id"
        label="编号"
        width="180">
      </el-table-column>
      <el-table-column
        prop="name"
        label="姓名"
        width="180">
      </el-table-column>
      <el-table-column
        prop="phone"
        label="电话"
        width="180">
      </el-table-column>
      <el-table-column
        prop="email"
        label="邮箱"
        width="180">
      </el-table-column>
      <el-table-column
        prop="createTime"
        label="创建时间"
        width="180">
      </el-table-column>
      <el-table-column
        prop="address"
        label="地址">
      </el-table-column>
      <el-table-column
        fixed="right"
        label="操作"
        width="120">
        <template slot-scope="scope">
          <el-button
            @click.native.prevent="deleteRow(scope.$index, tableData)"
            type="text"
            size="small">
            移除
          </el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination

      background
      layout="prev, pager, next,jumper,sizes"
      :total=totals
      @size-change="handleSizeChange"
      @current-change="currChange"
      :page-size=pageSize
    >
    </el-pagination>
  </div>
</template>

<script>
export default {
  name: 'dadawe',
  data () {
    return {
      currentPage4:1,
      pageSize:6,
      totals:0,
      tableData: []
    }
  },
  methods: {
    getAll(){
        let param = {"currentPage":this.currentPage4,"pageSize":this.pageSize}
        this.$http.post("/user/list",param).
          then(result=>{
            this.tableData=result.data.rows;
            this.totals=result.data.totals;
        })
    },
    handleSizeChange(val) {
      this.pageSize = val;
      this.currentPage4 = 1
      this.getAll();
    },
    currChange(val){
      this.currentPage4 = val;
      this.getAll()
    }
  },
  mounted() {
    this.getAll()
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>

</style>
